

var app = angular.module('plunker', ['ngTagsInput']);

app.controller('MainCtrl', function($scope, $http) {
    // An array of strings will be automatically converted into an
    // array of objects at initialization
    $scope.superheroes = [
        'Batman',
        'Superman'
    ];

    $scope.log = [];

    $scope.loadSuperheroes = function(query) {
        // An arrays of strings here will also be converted into an
        // array of objects
        return $http.get('superheroes.json');
    };

    $scope.tagAdded = function(tag) {
        $scope.log.push('Added: ' + tag.text);
    };

    $scope.tagRemoved = function(tag) {
        $scope.log.push('Removed: ' + tag.text);
    };
});


